package dao

import (
	"gorm.io/gorm"
	"water-temperature-server/config"
)

// CreateDao 创建链接对象
func CreateDao(data config.Database) *gorm.DB {
	var dao *gorm.DB
	switch data.Type {
	case "mysql":
		dao = Setup(data)
		break
	case "sqlserver":
		dao = Setup(data)
		break
	case "postgres":
		dao = Setup(data)
		break
	default:
		panic("错误数据库链接类型")
	}
	return dao
}
